﻿using MangoMes.Commont.DapperHelps;
using MangoMes.Commont.Domain.Jocker;
using MangoMes.Commont.DTOs;
using MangoMes.Commont.Infrastructures.Interfaces;
using MangoMes.Write.API.Applications.Login;
using MediatR;
using Microsoft.AspNetCore.Components.Forms;

namespace ManagoMes.Read.API.Applications.ProductionScheduling
{

    public class ProductionHtmlhandler : IRequestHandler<ProductionHtmlCommond, ResultsDTO<givebirth>>
    {

        private readonly IBateRepository<givebirth> _givebirth;

        private readonly Logincommonality _Logincommonality;

        public ProductionHtmlhandler(IBateRepository<givebirth> givebirth, Logincommonality logincommonality)
        {
            _givebirth = givebirth;
            _Logincommonality = logincommonality;
        }
       /// <summary>
       /// 生产任务显示
       /// </summary>
       /// <param name="request"></param>
       /// <param name="cancellationToken"></param>
       /// <returns></returns>
        public async Task<ResultsDTO<givebirth>> Handle(ProductionHtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = new ResultsDTO<givebirth>() { Code = 0 };
                var str = "select * from givebirth";
                var Empty = new givebirth();
                DapperHelper dapperHelper = new DapperHelper();
                var GEThtml = _givebirth.GetAll(str, Empty, dapperHelper.MangoMesRead).ToList();
                list.Data = GEThtml;
                var OperatorName = "123";
                var OperatorTime = DateTime.Now.ToString();
                var PerformOperation = "生产任务显示";
               _Logincommonality.Loginaddget(OperatorName, OperatorTime, PerformOperation);

                return list;
            }
            catch (Exception)
            {

                throw;
            }
           



        }

       


    }
}
